package com.aoyy.service;

import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.aoyy.model.Post;
import com.aoyy.dao.PostDao;
import com.aoyy.util.Page;
/**==============================================================================
 * Post service <code>PostService</code>
 * @author this author
 * @date 2017-08-16
 * ============================================================================== */
@Service
public class PostService {
	@Autowired
	private PostDao postDao;
	
	public void setPostDao(PostDao postDao) {
		this.postDao = postDao;
	}
	
	public PostDao getPostDao() {
		return postDao;
	}
	
	// @see com.aoyy.dao.PostDao
	public List<Post> queryPostsByPoticId(Integer topicId) {
		return postDao.queryPostsByTopicId(topicId);
	}
	
	// @see com.aoyy.dao.PostDao
	public Page pagedQuery(Integer pageNo, Integer pageSize, Integer topicId) {
		return postDao.pagedQuery(pageNo, pageSize, topicId);
	}
	
	// @see com.aoyy.dao.PostDao
	public Post queryPostByPostId(Integer postId) {
		return postDao.queryPostByPostId(postId);
	}
	
	// Save post
	public void save(Post post) {
		this.postDao.save(post);
	}
	
	// Delete post
	public void delete(Post post) {
		this.postDao.delete(post);
	}
	
	// Update post
	public void update(Post post) {
		this.postDao.update(post);
	}

}
